package com.guigu.leizihao.controller;

import com.guigu.common.pojo.SCell;
import com.guigu.common.pojo.SysUsers;
import com.guigu.leizihao.service.ScellService;
import com.guigu.common.vo.SearchVo;
import com.guigu.leizihao.vo.ScellCountVo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("/scell")
public class ScellControoler {

    @Resource
    private ScellService sCellService;

    /**
     * 查询已通过的产品
     * @param searchVo
     * @return
     */
    @RequestMapping("/queryDfile")
    @ResponseBody
    public SearchVo queryDfile(SearchVo searchVo){
        System.out.println("aa");
        SearchVo s= this.sCellService.queryDfile(searchVo);
        System.out.println(s);
        return s;
    }

    @RequestMapping("/reviewCellNo")
    @ResponseBody
    public int reviewCellNo(String storeId,String checker){
        this.sCellService.reviewCellNo(storeId,checker);
        return 1;
    }

    /**
     * 添加安全配置单
     * @param sCell
     * @return
     */
    @RequestMapping("/addScell")
    @ResponseBody
    public int addScell(@RequestBody SCell sCell){

        int i = this.sCellService.addScellService(sCell);
        if(i>0){
            return 1;
        }
            return 0;

    }


    /**
     * 查询待审核的安全配置单
     * @param searchVo
     * @return
     */
    @RequestMapping("/queryScellCheck")
    @ResponseBody
    public SearchVo queryScellCheck(SearchVo searchVo){


        SearchVo s= this.sCellService.queryScellCheck(searchVo);

        return s;
    }


    /**
     * 审核通过
     * @param storeId
     * @param checker
     * @return
     */
    @RequestMapping("/reviewOk")
    @ResponseBody
    public int reviewOk(String storeId,String checker){

        this.sCellService.review(storeId,checker);
        return 1;
    }


    /**
     * 查询所有的安全配置单
     * @param searchVo
     * @return
     */
    @RequestMapping("/queryScellAll")
    @ResponseBody
    public SearchVo queryScellAll(SearchVo searchVo){

        SearchVo s= this.sCellService.queryScellAll(searchVo);
        return s;

    }

    /**
     * 查询待审核的配置单
     * @param searchVo
     * @return
     */
    @RequestMapping("/queryScellChenge")
    @ResponseBody
    public SearchVo queryScellChenge(SearchVo searchVo){

        SearchVo s=this.sCellService.queryScellChenge(searchVo);
        return s;
    }


    /**
     * 变更配置单
     * @param sCell
     * @return
     */
    @RequestMapping("/ScellChange")
    @ResponseBody
    public String ScellChange(@RequestBody SCell sCell){
        int i=this.sCellService.ScellChange(sCell);
        System.out.println(sCell);
        return "ok";
    }

    @RequestMapping("/queryCount")
    @ResponseBody
    public ScellCountVo queryCount(){
        return this.sCellService.queryCount();
    }

}
